
package com.hlkj.pay.app.payment;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import java.math.BigDecimal;
import java.util.List;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import com.hlkj.framework.common.pojo.CommonResult;
import com.hlkj.pay.dto.merchant.MerchantAcctBalanceDto;
import com.hlkj.pay.dto.merchant.config.MerchantPaymentConfigMappingDto;
import com.hlkj.pay.dto.payment.MerchantPaymentPageDto;
import com.hlkj.pay.infrastructure.model.merchant.MerchantAppChannelDO;
import com.hlkj.pay.infrastructure.model.payment.MerchantPaymentDO;
import com.hlkj.pay.infrastructure.model.payment.MerchantPaymentDetailDO;
import com.hlkj.pay.vo.merchant.req.payment.MerchantPaymentApproveReq;
import com.hlkj.pay.vo.merchant.req.payment.MerchantPaymentDetailReq;
import com.hlkj.pay.vo.merchant.req.payment.MerchantPaymentDetailUpdateReq;
import com.hlkj.pay.vo.merchant.req.payment.MerchantPaymentFileReq;
import com.hlkj.pay.vo.merchant.resp.payment.MerchantPaymentDetailPageResp;
import com.hlkj.pay.vo.openapi.order.req.PayOrderQueryReq;
import com.hlkj.pay.vo.openapi.order.req.PaymentCommonParamReq;
import com.hlkj.pay.vo.openapi.order.resp.PaymentApiResp;

/**
 * @author HlpayTeam
 * @date 2024/11/20 14:15
 */
public interface IMerchantPaymentAppService {

    /**
     *
     * @param merchantPaymentApproveReq
     * @return
     */
    CommonResult<Void> approve(MerchantPaymentApproveReq merchantPaymentApproveReq);

    /**
     *
     * @param merchantPaymentFileReq
     * @return
     */
    CommonResult<String> addFilePayment(MerchantPaymentFileReq merchantPaymentFileReq);

    /**
     *
     * @param merchantPaymentDetailReq
     * @return
     */
    CommonResult<Void> addPayment(MerchantPaymentDetailReq merchantPaymentDetailReq);
    /**
     *
     * @param merchantAppChannelDO
     * @param merchantReportPaymentConfigList
     * @return
     */
    CommonResult<Set<String>> addReportPayment(MerchantAppChannelDO merchantAppChannelDO, BigDecimal totalAmount, List<MerchantPaymentConfigMappingDto> merchantReportPaymentConfigList);

    /**
     * 
     * @param merchantPaymentDetailUpdateReq
     * @return
     */
    CommonResult<Void> updatePayment(MerchantPaymentDetailUpdateReq merchantPaymentDetailUpdateReq);

    /**
     *
     * @param mchChannelCode
     * @param acctTypeList
     * @return
     */
    CommonResult<List<MerchantAcctBalanceDto>> queryAccount(String mchChannelCode, List<Integer> acctTypeList);

    /**
     * 
     * @param paymentId
     * @return
     */

    List<MerchantPaymentDetailDO> queryDetailList(String paymentId);
    /**
     *
     * @param detailPaymentId
     * @param request
     * @param response
     */
    CommonResult<String> queryProof(String detailPaymentId,boolean regenerate);
    /**
     *
     * @param detailPaymentId
     */
    CommonResult<String> queryDetailProof(String detailPaymentId);
    /**
     *
     * @param detailPaymentId
     * @return
     */
    CommonResult<Void> syncDetailStatus(String detailPaymentId);
    
	void syncAll(List<MerchantPaymentPageDto> merchantPaymentDtos);

    /**
     *
     * @param merchantPaymentDetailPageResp
     * @return
     */
    CommonResult<Void> submitDetail(MerchantPaymentDetailPageResp merchantPaymentDetailPageResp);

    /**
     *
     * @param paymentCommonParamReq
     * @return
     */
    CommonResult<PaymentApiResp> submitOpenapi(@Valid PaymentCommonParamReq paymentCommonParamReq);

    /**
     *
     * @param payOrderQueryReq
     * @return
     */
    CommonResult<PaymentApiResp> queryOpenApiDetail(PayOrderQueryReq payOrderQueryReq);

    /**
     *
     * @param paymentId
     * @param servletRequest
     * @return
     */
    String orderStatusCallBack(String paymentId, HttpServletRequest servletRequest);
    /**
     *
     * @param channelCode
     * @param servletRequest
     * @return
     */
    String orderStatusFixCallBack(String channelCode, HttpServletRequest servletRequest);

    CommonResult<String> addRecharge(MerchantPaymentDetailReq merchantPaymentDetailReq);

    /**
     *
     * @param merchantPaymentDO
     * @param merchantPaymentDetailDO
     */
    void notifyChannel(MerchantPaymentDO merchantPaymentDO,MerchantPaymentDetailDO merchantPaymentDetailDO);
}
